﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Workflow.Common.Dao;
using Workflow.IDAO;
using Workflow.Model;
using NHibernate.Linq;

namespace Workflow.DAO
{
	public class CaseReasonDao : RepositoryBase<CaseReason>, ICaseReasonDao
	{

		public IList<CaseReason> GetRejectReason(string caseType,string reasonType)
		{
			var result = Session.Query<CaseReason>();

			result = result.Where(x => x.CaseType == caseType);

			result = result.Where(x => x.ReasonType == reasonType);

			result = result.OrderBy(x => x.ReasonOrder);

			return result.ToList();
		}

		public IList<CaseReason> GetCaseReasonByType(string caseType)
		{
			var result = Session.Query<CaseReason>();

			result = result.Where(x => x.CaseType == caseType);

			result = result.OrderBy(x => x.ReasonOrder);

			return result.ToList();
		}
	}
}
